package com.classeven.downhill.element;

import org.andengine.opengl.font.Font;
import org.andengine.opengl.font.FontFactory;
import org.andengine.opengl.texture.ITexture;
import org.andengine.opengl.texture.TextureOptions;
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;

import com.classeven.downhill.define.iGameDefines;
import com.classeven.downhill.engine.GameEngine;
import com.classeven.downhill.engine.Utils;

public class AFont 
{
	Font font;
	
	GameEngine theEngine;
	
	public AFont(GameEngine mainActivity, int index)
	{
		this.theEngine = mainActivity;
		Load(index);
	}
	
	void Load(int index) 
	{
		final ITexture fontTexture = new BitmapTextureAtlas( theEngine.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
		font = FontFactory.createFromAsset(theEngine.getFontManager(), fontTexture,
				theEngine.getAssets(), iGameDefines.FONT_GAME[index].getPath(), Utils.GetRatioWidth(iGameDefines.FONT_GAME[index].getSize()), true, iGameDefines.FONT_GAME[index].getColor());
		font.load();
	}
	
	public Font theFont()
	{
		return font;
	}
}
